Skip to content

Conversation

@kamalmostafa
Copy link
Contributor

@kamalmostafa kamalmostafa commented Aug 4, 2024

Description

Make the --disable-missing-files-check flag actually inhibit the collection of a files list, not just the display of the missing files dialog.

Fixes a memory leak of the files list itself when the flag is used (and there are some missing files).

Closes: #11074

Motivation and Context

Fix memory leak: #11074

How Has This Been Tested?

Manual testing of consistent behavior.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

Copy link
Member

@PatTheMav PatTheMav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bugfix is a bit messy, but that's because of the original implementation is messy to begin with:

  • AddMissingFiles will automagically call obs_missing_files_create when obs_source_get_missing_files is called (because that function has two fallback paths that create a new struct)
  • obs_load_sources is only used in this single instance in the entire application, so its only purpose is to provide the AddMissingFiles callback when loading sources
  • This suggests that the check for missing files is an architectural fixture, not an "optional" feature (as the startup argument suggests)
  • The memory allocated by obs_missing_files_create (which is always allocated somehow) is only explicitly released when ShowMissingFilesDialog is called:
    • Either no files are missing, so obs_missing_files_destroy is called directly
    • The OBSMissingFiles instance initialised is deallocated at some point (because it's destructor calls obs_missing_files_destroy.

This change only fixes the symptoms of the underlying architectural issue (e.g. the memory is allocated independently from UI functionality and thus should also be released independently from showing any dialogs), but it does avoid the memory leak.

@WizardCM WizardCM added the Bug Fix Non-breaking change which fixes an issue label Aug 10, 2024
Make the --disable-missing-files-check flag actually inhibit the
collection of a `files` list, not just the display of the missing files
dialog.

Fixes a memory leak of the `files` list itself when the flag is used
(and there are some missing files).

Closes: obsproject#11074
@PatTheMav
Copy link
Member

Please rebase this PR and give it another pass to make it ready for review/merging again. Cursory check makes this approach preferable to the one in #12628.

@RytoEX RytoEX self-assigned this Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Fix Non-breaking change which fixes an issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory leak when --disable-missing-files-check is used

4 participants